<template>
  <div class="left-box">
    <h2>Left组件</h2>
    <h3>count:{{$store.state.count}}</h3>
    <h3>doubleCount:{{$store.getters.doubleCount}}</h3>
    <button @click="addOne">+2</button>
  </div>
</template>

<script>
export default {
    methods:{
        addOne(){
            /**
             * 组件中如果要去调用vuex仓库中mutations中的指定方法
             * 需要使用this.$store.commit(mutations的方法名,传递参数)
             */
            this.$store.commit("incrementSync",2)
        }
    }
}
</script>

<style lang="scss" scoped>
    .left-box{
        flex-grow: 1;
        height: 100vh;
        background:orange;
    }
</style>